package org.intellij.doctree.node;

import java.io.Serializable;

public class FolderNode extends DocTreeNode implements Serializable {

    public static final DocTreeNode PROJECT_ROOT = new FolderNode("Project", false);
    public static final DocTreeNode APPLICATION_ROOT = new FolderNode("Application", false);

    public FolderNode(Folder folder) {
        super(folder);
        setAllowsChildren(true);
    }

    public FolderNode(String name, boolean editable) {
        this(name);
        setEditable(editable);
    }

    public FolderNode(String name, String description) {
        super(new Folder(name, description));
        setAllowsChildren(true);
    }

    public FolderNode(String name) {
        this(name, null);
    }

    public Folder getFolder() {
        return ((Folder) userObject);
    }

    public void setFolder(Folder folder) {
        setUserObject(folder);
    }

    public String getName() {
        Folder f = getFolder();
        if (f == null) return null;
        return f.getName();
    }

    public String getDescription() {
        Folder f = getFolder();
        if (f == null) return null;
        return f.getDescription();
    }
}
